********************************************************************************
********************************************************************************
*       Date:       September 2016                                       
*
*       Purpose:   	Do-file to replicate the results of the article 
*                  	"Taxing higher incomes: What makes the high-income earners 
*					consent to more progressive taxation in Latin America?"          
*
*					Analysis do-file     
*
*       Authors:    Sarah Berens (University of Cologne)     
*					Armin von Schiller (German Development Institute & Hertie School of Governance)       
********************************************************************************

version 13.0
* Change directory
cd "C:your_path_to_the_folder"

* Note: please run the dofile "Replication_Taxing higher incomes_datamangement" to obtain the dataset to be used in order to replicate the results
use "Data generated through datamanagement dofile", clear



********************************************************************************

****************
* Table 1
****************


estimates clear
global xs_var  i.gender age  edu_years   household_size i.urban 
global x_var  i.gender age  edu_years i.emp_stat2 i.mobility household_size married i.urban lazy privatization  social_trust
global cty_var b17.countryID 

	set more off
	logit tax_dummy i.wealth_group_3pais c.respect_polinst $xs_var $cty_var , vce(cluster pais ) 
	estimates store m1
	
	logit tax_dummy i.wealth_group_3pais c.reliability_avs  $xs_var $cty_var , vce(cluster pais ) 
	estimates store m2 
	
	
	logit tax_dummy i.wealth_group_3pais##c.respect_polinst $xs_var $cty_var , vce(cluster pais ) 
	estimates store m3
	
	logit tax_dummy i.wealth_group_3pais##c.reliability_avs $xs_var $cty_var , vce(cluster pais )
	estimates store m4
	
	logit tax_dummy i.wealth_group_3pais##c.respect_polinst $x_var $cty_var , vce(cluster pais ) 
	estimates store m5 
		
	logit tax_dummy i.wealth_group_3pais##c.reliability_avs $x_var $cty_var , vce(cluster pais ) 
	estimates store m6 

	est tab m*, star(.1 .05 .01) stat(N ll aic bic chi2) ///
	title("Logistic regression: Progressive income tax preferences") 
		
esttab m* using Tab1_base.tex, replace cells(b (star fmt(3)) se(par fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) label  se bic                               /// 
		title("Logistic regression: Progressive income tax preferences ")       ///
		nonumbers mtitles ("(M 1)" "(M 2)" "(M 3)" "(M 4)" "(M 5)" "(M 6)")  ///
		addnote("Source: LAPOP 2012")


*********************
* APPENDIX
*********************

* TABLE A
sum tax_dummy i.wealth_group i.class_id  respect_polins reliability_avs ///
gender age edu_years  b3.emp_stat2 b3.mobility household_size married  ///
 lazy social_trust privatization left redistribution urban ///
 b1 trust_parties trust_legis
* to receive values for the remaining categories 
sum b2.wealth_group i.emp_stat2 i.mobility

* show correlation: Table B
replace q10new=99 if q10new==.a
replace q10new=98 if q10new==.b
replace q10new=97 if q10new==.c
pwcorr q10new wealth1 multi_car if q10new<33, sig

* show correlation: Table C
pwcorr tax_dummy wealth_group respect_polins reliability_avs  lazy social_trust privatization , sig
 
********************
* SUPPLEMENTARY MATERIAL
********************
		
*********************
* Table S1 
*********************

estimates clear
global xs_var  i.gender age  edu_years   household_size i.urban 
global x_var  i.gender age  edu_years i.emp_stat2 i.mobility household_size married urban lazy privatization social_trust b1
global k_var  i.gender age  edu_years i.emp_stat2 i.mobility household_size married urban lazy privatization social_trust
global cty_var b17.countryID 

	set more off
	
	logit tax_dummy i.rich90_3pais##c.respect_polinst $k_var $cty_var , vce(cluster pais ) 
	estimates store m1 
	
	
	logit tax_dummy i.rich90_3pais##c.reliability_avs $k_var $cty_var , vce(cluster pais ) 
	estimates store m2
	
	
	logit tax_dummy c.wealth1##c.respect_polinst $k_var $cty_var , vce(cluster pais ) 
	estimates store m3
	
	set more off
	logit tax_dummy c.wealth1##c.reliability_avs $k_var $cty_var , vce(cluster pais ) 
	estimates store m4 
		 

	logit tax_dummy i.wealth_group_3pais##c.respect_polinst $x_var $cty_var , vce(cluster pais ) 
	estimates store m5
	
est tab m*, star(.1 .05 .01) stat(N ll aic bic chi2) ///
	title("Robustness Test; Top 10% of wealth indicator, wealth as continuous variable and enforcement capacity") 
		
esttab m* using TabS1.tex, cells(b (star fmt(3)) se(par fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) label  se bic                               /// 
		title("Robustness Test; Top 10% of wealth indicator, wealth as continuous variable and enforcement capacity")       ///
		nonumbers mtitles ("(M 1)" "(M 2)" "(M 3)" "(M 4)" "(M 5)" )  ///
		addnote("Source: LAPOP 2012")	


		
***************
* TABLE S2
***************	
estimates clear
global x_var  i.gender age  edu_years i.emp_stat2 i.mobility household_size married urban lazy privatization b1 
global k_var  i.gender age  edu_years i.emp_stat2 i.mobility household_size married urban lazy privatization
global cty_var b17.countryID 


* HOUSEHOLD INCOME
replace q10new= 99 if q10new==.a
replace q10new= 98 if q10new==.b
replace q10new= 97 if q10new==.c
	
	set more off
	logit tax_dummy i.q10new##c.respect_polinst $k_var $cty_var if  q10new<33 & q10new!=0 , vce(cluster pais )
	estimates store m1
	
	set more off
	logit tax_dummy i.q10new##c.reliability_avs $k_var $cty_var if  q10new<33 & q10new!=0 , vce(cluster pais )
	estimates store m2 
	
* MULTICAR
	logit tax_dummy i.multi_car##c.respect_polinst $k_var $cty_var , vce(cluster pais ) 
	estimates store m3
	
	logit tax_dummy i.multi_car##c.reliability_avs $k_var $cty_var , vce(cluster pais ) 
	estimates store m4 
	
    est tab m*, star(.1 .05 .01) stat(N ll aic bic chi2) ///
	title("Robustness tests: Self-reported income and owning more than one car") 
	
esttab m* using TabS2.tex, cells(b (star fmt(3)) se(par fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) label  se bic                               /// 
		title("Robustness tests: Self-reported income and owning more than one car")       ///
		nonumbers mtitles ("(M 1)" "(M 2)" "(M 3)" "(M 4)" )  ///
		addnote("Source: LAPOP 2012")
		
		
*******
* Table S3
*******

estimates clear
	set more off
	logit tax_dummy i.wealth_group_3pais##c.respect_polinst  , vce(cluster pais ) 
	estimates store m1
	
	logit tax_dummy i.wealth_group_3pais##c.reliability_avs , vce(cluster pais ) 
	estimates store m2 
	
global x_var  i.gender age  edu_years i.emp_stat2 i.mobility household_size married urban lazy privatization b1 
global k_var  i.gender age  edu_years i.emp_stat2 i.mobility household_size married urban lazy privatization
	
	logit tax_dummy i.class_id##c.respect_polinst $x_var $cty_var , vce(cluster pais ) 
	estimates store m3 
	
	logit tax_dummy i.class_id##c.reliability_avs $x_var $cty_var , vce(cluster pais ) 
	estimates store m4 

	set more off
	logit tax_dummy_without_moderate i.wealth_group_3pais##c.respect_polinst $x_var $cty_var , vce(cluster pais ) 
	estimates store m5
	
	logit tax_dummy_without_moderate i.wealth_group_3pais##c.reliability_avs $x_var $cty_var , vce(cluster pais ) 
	estimates store m6 
	
	
est tab m*, star(.1 .05 .01) stat(N ll aic bic chi2) ///
	title("Robustness tests") 
		
esttab m* using TabS3.tex, cells(b (star fmt(3)) se(par fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) label  se bic                               /// 
		title("Robustness tests")       ///
		nonumbers mtitles ("(M 1)" "(M 2)" "(M 3)" "(M 4)" "(M 5)" "(M 6)" )  ///
		addnote("Source: LAPOP 2012")		
		

*******
* Table S4
*******

	set more off
	global x_var  i.gender age  edu_years i.emp_stat2 i.mobility household_size married urban lazy privatization b1 
	global k_var  i.gender age  edu_years i.emp_stat2 i.mobility household_size married urban lazy privatization
	estimates clear
	******* I would vote for the incumbent party or candidate
	logit tax_dummy i.wealth_group_3pais##c.respect_polinst $x_var $cty_var if vb20==2, vce(cluster pais ) 
	estimates store m1
	logit tax_dummy i.wealth_group_3pais##c.reliability_avs $k_var $cty_var if vb20==2, vce(cluster pais ) 
	estimates store m2
	
    ******* I would not vote the incumbent party or candidate but vote 
	logit tax_dummy i.wealth_group_3pais##c.respect_polinst $x_var $cty_var if vb20==3 | vb20==4, vce(cluster pais ) 
	estimates store m3
	logit tax_dummy i.wealth_group_3pais##c.reliability_avs $k_var $cty_var if vb20==3 | vb20==4, vce(cluster pais ) 
	estimates store m4	
	
	est tab m*, star(.1 .05 .01) stat(N ll aic bic chi2) ///
	title("Partisan attachment") 
		
esttab m* using TabS4.tex, cells(b (star fmt(3)) se(par fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.001) label  se bic                               /// 
		title("Partisan attachment")       ///
		nonumbers mtitles ("(M 1)" "(M 2)" "(M 3)" "(M 4)")  ///
		addnote("Source: LAPOP 2012")			
		
		
